<template>
	<view class="health-examination-detail-wrapper">

		<view class="header">
			<image :src="detail.athumb"></image>
			<p class="title">
				{{detail.atitle}}
			</p>
			<p class="price">
				￥{{detail.price}}
			</p>
			<p style="font-size: 0.9rem;" v-html="detail.notes"></p>
		</view>
		
		<view class="bottom-tabbar">
			<view class="submit-btn" @click="openForm">
				<p>立即预约</p>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				detail: {},
				tijianid: ''
			}
		},
		onLoad(option) {
			this.api_tijian_detail(option.id)
			this.tijianid = option.id
		},
		methods: {
			openForm() {
				console.log(this.tijianid)
				if (this.tijianid == "15") {
					uni.navigateTo({
						url: '/pages/healthExamination/childSchoolForm?tijianid=' + this.tijianid,
						success: (res) => {
							// 通过eventChannel向被打开页面传送数据
							res.eventChannel.emit('detail', { data: this.detail })
						}
					})
				}else if (this.tijianid == "16") {
					uni.navigateTo({
						url: '/pages/healthExamination/childWorkerForm?tijianid=' + this.tijianid,
						success: (res) => {
							// 通过eventChannel向被打开页面传送数据
							res.eventChannel.emit('detail', { data: this.detail })
						}
					})
				}else if (this.tijianid == "13" || this.tijianid == "14") {
					uni.navigateTo({
						url: '/pages/healthExamination/premaritalCheckUpForm?tijianid=' + this.tijianid,
						success: (res) => {
							// 通过eventChannel向被打开页面传送数据
							res.eventChannel.emit('detail', { data: this.detail })
						}
					})
				}
			},
			api_tijian_detail(id) {
				this.$app._get('entry/wxapp/tijian.detail', {
					id: id
				}, (result) => {
					this.detail = result
					console.log(result)
				})
			},
			onClick() {

			}
		}
	}
</script>

<style lang="scss" scoped>
	.health-examination-detail-wrapper {
		width: 100%;
		height: 100%;
		background-color: #fff;
		box-sizing: border-box;
		padding: 15px;
		
		.header {
			border-radius: 6px;
			border: 1px solid #e3e3e3;
			padding: 10px;
			line-height: 25px;
			background-color: #f5f5f5;
			font-size: .9rem;
			color: #757575;
			image {
				margin-bottom: 10px;
			}
			.title {
				font-size: 1.2rem;
			}
			.price {
				color: #ff9800;
			}
		}
	}
	
	.bottom-tabbar {
		position: fixed;
		left: 0;
		bottom: 0;
		width: 100%;
		height: 80px;
		text-align: center;
		line-height: 80px;
		font-size: 1.1rem;
		color: #fff;
		background-color: #41C177;
	}
</style>